package com.egg.auth.controller.feign;


import com.egg.auth.entity.Test;
import com.egg.auth.feign.AuthTestFeignClient;
import com.egg.auth.model.request.web.TestPost;
import com.egg.auth.service.test.ITestService;
import com.egg.common.core.model.controller.FeignController;
import com.egg.common.core.model.response.ResponseData;
import com.egg.common.util.JsonUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Slf4j
@Api(tags = FeignController.API_PREFIX + "测试中心")
@RestController
@RequestMapping("/test")
public class FeignTestController extends FeignController implements AuthTestFeignClient {


    @Autowired
    private ITestService testService;


    @Override
    @ApiOperation(value = "测试提交")
    @PostMapping
    public ResponseData<Long> post(@RequestBody TestPost param) {
        Test test = JsonUtil.objToObj(param, Test.class);
        testService.baseAdd(test);
        return ResponseData.success(test.getId());
    }


}

